import java.util.Scanner;
public class Test {
    public static void main(String[] args) { //求最大值的重载
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入两个整数：");
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int ret = max1(a,b);
        System.out.println(a+"和"+b+"的较大值为"+ret);
        System.out.println("请在输入三个小数");
        double d1 = scanner.nextDouble();
        double d2 = scanner.nextDouble();
        double d3 = scanner.nextDouble();
        double ret1 = max1(d1,d2,d3);
        System.out.println(d1+"和"+d2+"和"+d3+"的最大值为"+ret1);

    }
    public static int max1 (int x,int y) { //求两个整数的最大值
        return (x > y ? x: y);
    }
    public static double max1(double x,double y,double z) { //求三个小数的最大值
        //return (max(max(x,y),z));
        double temp = x > y ? x :y;
        return temp > z ? temp : z;
    }
    public static void main4(String[] args) {  //求和的重载
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入两个整数：");
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int sumInt = add(a,b);
        System.out.println(a+"+"+b+"="+sumInt);
        System.out.println("请输入三个小数：");
        double d1 = scanner.nextDouble();
        double d2 = scanner.nextDouble();
        double d3 = scanner.nextDouble();
        double sumDouble = add(d1,d2,d3);
        System.out.printf("%f+%f+%f=%f\n",d1,d2,d3,sumDouble);
        System.out.println(d1+"+"+d2+"+"+d3+"="+sumDouble);

    }
    public static double add(double d1,double d2,double d3) {
        return (d1+d2+d3);
    }
    public static int add(int x,int y) {
        return (x+y);
    }
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数:");
        int n = scanner.nextInt();
        int ret = fact(n);
        System.out.println(n+"的阶乘为："+ret);
        int sum = factsum(n);
        System.out.println(n+"的阶乘和为: "+sum);
    }
    public static int factsum(int n) { //计算N的阶乘和
        int sum = 0;
        while (n != 0) {
            sum += fact(n);
            n--;
        }
        return sum;
    }
    public static int fact(int n) { //计算N的阶乘
        int ret =1;
        while(n!=0) {
            ret*=n;
            n--;
        }
        return ret;
    }
    public static void main2(String[] args) { //求最大值
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入两个数：");
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int ret = max(a,b);
        System.out.println(a+"和"+b+"的较大值为"+ret);
        System.out.println("请在输入一个数");
        int c = scanner.nextInt();
        int ret1 = max(a,b,c);
        System.out.println(a+"和"+b+"和"+c+"的最大值为"+ret1);

    }
    public static int max (int x,int y) { //求两个数的最大值
        return (x > y ? x: y);
    }
    public static int max(int x,int y,int z) { //求三个数的最大值
        //return (max(max(x,y),z));
        int temp=max(x,y);
        return max(temp,z);
    }
    public static void main1(String[] args) {   //打印自幂数
//153 = 1^3 + 5^3 + 3^3
        for (long i = 0; i < 9999999; i++) {
            int count = 0;//计算当前i 有几位数
            long tmp = i;
            while (tmp != 0) {
                count++;
                tmp = tmp / 10;
            }
//count的值 是多少已经计算完成   i还是没有变的
//计算i[tmp]的每一位
            tmp = i;
            int sum = 0;
            while(tmp!=0) {
                sum+=(int)Math.pow(tmp%10,count);
                tmp/=10;
            }
            if(sum==i) {
                switch (count) {
                    case 1:
                        System.out.println(i+"是独身数");
                        break;
                    //case 2:
                        //System.out.println(i+"是");
                        //break;
                    case 3:
                        System.out.println(i+"是水仙花数");
                        break;
                    case 4:
                        System.out.println(i+"是四叶玫瑰数");
                        break;
                    case 5:
                        System.out.println(i+"是五角星数");
                        break;
                    case 6:
                        System.out.println(i+"是六合数");
                        break;
                    case 7:
                        System.out.println(i+"是北斗七星数");
                        break;
                }
            }
        }
    }
}

